//
//  NoticeView.swift
//  AirTravel
//
//  Created by tulip on 2021/9/2.
//

import UIKit

class NoticeView: UIView {
    var title:UILabel!
    var lab:UILabel!
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor=UIColor.black.withAlphaComponent(0.6)
        
        let box=UIView.init(frame: CGRect(x: 15, y: SCREEN_HEIGHT/2.0-100, width: SCREEN_WIDTH-30, height: 200))
        box.backgroundColor=UIColor.white
        self.addSubview(box)
        
        let line=UIView.init(frame: CGRect(x: 15, y: 15+4, width: 3, height: 8))
        line.backgroundColor=UIColor.init(hexString: "ff7e00")
        box.addSubview(line)
        
         title=UILabel.init(frame: CGRect(x: 28, y:15, width: SCREEN_WIDTH-28-40, height: 16))
        title.textColor=UIColor.black
        title.font=UIFont.boldSystemFont(ofSize: 15)
        box.addSubview(title)
        
        let closebtn=UIButton.init(frame: CGRect(x: box.frame.size.width-35, y: 15, width: 20, height: 20))
        closebtn.setImage(UIImage(named: "地点选择-关闭"), for: .normal)
        closebtn.addTarget(self, action: #selector(close), for: .touchUpInside)
        box.addSubview(closebtn)
        
        lab=UILabel.init(frame: CGRect(x: 15, y: title.frame.size.height+title.frame.origin.y+15, width: box.frame.size.width-30, height: box.frame.size.height-56))
        lab.textColor=UIColor.init(hexString: "333333")
        lab.font=UIFont.systemFont(ofSize: 14)
        lab.numberOfLines=0
        box.addSubview(lab)
        
        
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    @objc func close(){
        self.removeFromSuperview()
    }
    
    func setContent(titleStr:String,contentStr:String){
        title.text=titleStr
        lab.text=contentStr
    }
    
    
}
